// main.cpp
#include "smart_tensor.h"
#include <iostream>

int main() {
    try {
        // 创建一个2x3的张量
        std::vector<int> shape1 = {2, 3};
        SmartTensor tensor1(shape1);
        tensor1.set({0, 0}, 1.0);
        tensor1.set({0, 1}, 2.0);
        tensor1.set({0, 2}, 3.0);
        tensor1.set({1, 0}, 4.0);
        tensor1.set({1, 1}, 5.0);
        tensor1.set({1, 2}, 6.0);

        // 创建一个3x2的张量
        std::vector<int> shape2 = {3, 2};
        SmartTensor tensor2(shape2);
        tensor2.set({0, 0}, 7.0);
        tensor2.set({0, 1}, 8.0);
        tensor2.set({1, 0}, 9.0);
        tensor2.set({1, 1}, 10.0);
        tensor2.set({2, 0}, 11.0);
        tensor2.set({2, 1}, 12.0);

        // 测试矩阵乘法
        SmartTensor product = tensor1.matrixMultiply(tensor2);
        std::cout << "Tensor 1:" << std::endl;
        tensor1.print();
        std::cout << "Tensor 2:" << std::endl;
        tensor2.print();
        std::cout << "Product of Tensor 1 and Tensor 2:" << std::endl;
        product.print();

    } catch (const std::invalid_argument& e) {
        std::cerr << "Error: " << e.what() << std::endl;
    }

    return 0;
}